<?php

require_once 'init.php';

$group = cf\api\shop\getCategory(cf\param::get('id'));
$smarty->assign('group',$group);

$smarty->assign('topGroup',cf\api\shop\getCategory($group['branch'][0]['id']));

$branch = cf\api\shop\getCategoriesTree($group['branch'][0]['id']);
$smarty->assign('topBranch',$branch);

$groups = cf\api\shop\getCategoriesTree($group['id'],false,1);
$smarty->assign('groups',$groups);

$smarty->assign('leftTpl','group_left_tree');

$products = new cf\Products($group['id']);

$attrsFilter = cf\param::exist('a') ? cf\param::get('a') : array();
$smarty->assign('attrsFilter',json_encode($attrsFilter));
$products->filterByAttributes($attrsFilter);

$smarty->assign('products',$products->getList());

show('group', $group['name'], $group['branch']);
?>

